﻿#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QMessageBox>
#include <QFileDialog>
#include <QMetaEnum>
#include <QUrl>
#include <QFile>
#include <QDir>


QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private slots:
    void on_btnUp_clicked();
    void on_btnDown_clicked();

    bool initFTP();
    void replyFinished(QNetworkReply*);
    void loadProgress(qint64 bytesSent, qint64 bytesTotal);
    QString getFileName(QString m_filePath);
    void readContent();
    void replyError(QNetworkReply::NetworkError error);

private:
    Ui::Widget *ui;

    QNetworkAccessManager *m_AccessManager;

    QString m_FtpPath;
    QString m_User;
    QString m_Password;

    QFile *m_file;

    QNetworkReply *m_reply;
};
#endif // WIDGET_H
